{extend name="../../../view/public/base" /}
{block name="css"}
<style>

    /*.select-test{position: absolute;max-height: 500px;height: 350px;overflow: auto;width: 100%;z-index: 123;display: none;border:1px solid silver;top: 42px;}*/
    /*.layui-show{display: block!important;}*/
    body {
        padding: 20px; background-color: #F2F2F2;
    }
    /*.layui-input-block{*/
    /*height:auto;*/
    /*overflow:visible;*/
    /*text-overflow:inherit;*/
    /*!*text-overflow:none;*!*/
    /*}*/
    .layui-form-pane .layui-form-label {
        font-size: 10px;
    }
    .layui-elip, .layui-form-checkbox span, .layui-form-pane .layui-form-label {
        text-overflow:clip;
        white-space: nowrap;
    }
    /*.layui-input-block .layui-input{*/
    /*display: block;*/
    /*width: 80%;*/
    /*padding-left: 15px;*/
    /*padding-right: 15px;*/
    /*}*/
    /*.layui-tab-item{*/
    /*width: 100%;*/
    /*height: 800px;*/
    /*}*/
</style>
<link rel="stylesheet" href="/layui/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
<!--<link rel="stylesheet" href="/layui/js/lay-module/upload/cropper/publish.css" media="all">-->

{/block}
{block name="body"}
<!--<form class="layui-form layui-form-pane" id="form">-->


    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">配置设置</div>
                <div class="layui-card-body">

                    <div class="layui-tab layui-tab-card" lay-filter="docDemoTabBrief">
                        <ul class="layui-tab-title"  >
                            {volist name="show" id="vo" key="k"}
                            {eq name="k" value="1"}
                            <li class="layui-this"><i class="{$vo.icon}"></i>&nbsp&nbsp{$vo.title}</li>
                            {else/}
                            <li><i class="{$vo.icon}"></i>&nbsp&nbsp{$vo.title}</li>
                            {/eq}
                            {/volist}
                        </ul>

                        <div class="layui-tab-content" >

                            {volist name="show" id="vo" key="k"}
                            <div class='layui-tab-item {eq name="k" value="1"}layui-show{/eq}'>
                                {if condition="($vo.desc!=null) && ($vo.desc!='') "}
                                <blockquote class="layui-elem-quote">{$vo.desc|RAW}</blockquote>
                                {/if}
                                <table class="layui-table" >
                                    <colgroup>
                                        <col  width="600">
                                        <col>

                                    </colgroup>
                                    <thead>
                                    <tr >
                                        <th style="text-align: center">配置值</th>
                                        <th style="text-align: center">配置字段</th>

                                    </tr>
                                    </thead>
                                </table>
                                <br>
                                <form class="layui-form layui-form-pane" id="form-{$k}">
                                {volist name="vo.config_list" id="config" key="i"}


                                <!--生成表单   start-->
                                {switch name="config.type"}
                                {case value="text"}
                                <!--普通文本框-->

                                {switch name="config.input_type"}
                                {case value="text"}
                                <!--普通文本框-->
                                <div class="layui-form-item">
                                    <div class="layui-col-md7">
                                        <label class="layui-form-label" >{$config.info}</label>
                                        <div class="layui-input-block" id="{$config.config_name}">
                                            <input  type="text" name="{$config.config_name}"
                                                    autocomplete="off" placeholder="{$config.info}" class="layui-input"
                                                    value="{$config.value|default=''}">
                                        </div>
                                    </div>
                                    <div class="layui-col-md5">
                                        <div class="layui-input-block" >
                                            {$config.label_name}
                                        </div>
                                    </div>


                                </div>
                                <script>

                                    layui.use(['jquery','layer'],function() {
                                        var $ = layui.jquery,
                                            layer = layui.layer;
                                        $(function(){
                                            var tips;
                                            $('#{$config.config_name}').on({
                                                mouseenter:function(){
                                                    var that = this;
                                                    tips =layer.tips("{$config.desc}",that,{tips:[1,'#5FB878'],time:0, area: 'auto'});
                                                },
                                                mouseleave:function(){
                                                    layer.close(tips);
                                                }
                                            });
                                        })

                                    })

                                </script>


                                {/case}
                                {case value="number"}
                                <!--数字文本框-->
                                <div class="layui-form-item">
                                    <div class="layui-col-md7">
                                        <label class="layui-form-label" >{$config.info}</label>
                                        <div class="layui-input-block" id="{$config.config_name}">
                                            <input  type="number" name="{$config.config_name}"
                                                    autocomplete="off" placeholder="{$config.info}" class="layui-input"
                                                    oninput = "value=value.replace(/[^\d]/g,'')"
                                                    value="{$config.value|default=''}">
                                        </div>

                                    </div>
                                    <div class="layui-col-md5">
                                        <div class="layui-input-block" >
                                            {$config.label_name}
                                        </div>
                                    </div>

                                </div>
                                <script>

                                    layui.use(['jquery','layer'],function() {
                                        var $ = layui.jquery,
                                            layer = layui.layer;
                                        $(function(){
                                            var tips;
                                            $('#{$config.config_name}').on({
                                                mouseenter:function(){
                                                    var that = this;
                                                    tips =layer.tips("{$config.desc}",that,{tips:[1,'#5FB878'],time:0,area: 'auto'});
                                                },
                                                mouseleave:function(){
                                                    layer.close(tips);
                                                }
                                            });
                                        })

                                    })

                                </script>



                                {/case}
                                {case value="timestamp"}
                                <!--日期-->
                                <div class="layui-form-item">
                                    <div class="layui-col-md7">
                                        <label class="layui-form-label" >{$config.info}</label>
                                        <div class="layui-input-block" id="{$config.config_name}">
                                            <input  type="text" name="{$config.config_name}"
                                                    id="time{$config.config_name}"

                                                    autocomplete="off" placeholder="{$config.info}" class="layui-input"
                                            >
                                        </div>
                                    </div>
                                    <div class="layui-col-md5">
                                        <div class="layui-input-block" >
                                            {$config.label_name}
                                        </div>
                                    </div>

                                </div>
                                <script>

                                    layui.use(['jquery','layer', 'laydate','util'],function() {
                                        var $ = layui.jquery,
                                            layer = layui.layer
                                            ,util = layui.util
                                            ,laydate = layui.laydate;
                                        $(function(){
                                            var tips;
                                            $('#{$config.config_name}').on({
                                                mouseenter:function(){
                                                    var that = this;
                                                    tips =layer.tips("{$config.desc}",that,{tips:[1,'#5FB878'],time:0,area: 'auto'});
                                                },
                                                mouseleave:function(){
                                                    layer.close(tips);
                                                }
                                            });
                                        })

                                        //日期时间选择器
                                        laydate.render({
                                            elem: '#time{$config.config_name}'
                                            ,value: new Date(parseInt('{$config.value? $config.value : 0}')*1000)
                                            ,isInitValue: true
                                            ,type: 'datetime'
                                        });
                                    })

                                </script>


                                {/case}
                                {case value="color"}
                                <!--颜色选择器-->
                                <div class="layui-form-item">
                                    <div class="layui-col-md7">
                                        <label class="layui-form-label" >{$config.info}</label>
                                        <div class="layui-input-block" id="{$config.config_name}">
                                            <div id="color{$config.config_name}" style="margin-left: 30px;"></div>
                                            <input  type="hidden" name="{$config.config_name}"
                                                    id="input{$config.config_name}"
                                                    value="{$config.value? $config.value : ''}"
                                            >
                                        </div>
                                    </div>
                                    <div class="layui-col-md5">
                                        <div class="layui-input-block" >
                                            {$config.label_name}
                                        </div>
                                    </div>

                                </div>
                                <script>

                                    layui.use(['jquery','layer','colorpicker'],function() {
                                        var $ = layui.jquery,
                                            layer = layui.layer
                                            ,colorpicker = layui.colorpicker;
                                        $(function(){
                                            var tips;
                                            $('#{$config.config_name}').on({
                                                mouseenter:function(){
                                                    var that = this;
                                                    tips =layer.tips("{$config.desc}",that,{tips:[1,'#5FB878'],time:0,area: 'auto'});
                                                },
                                                mouseleave:function(){
                                                    layer.close(tips);
                                                }
                                            });
                                        })


                                        colorpicker.render({ //无初始色值时
                                            elem: '#color{$config.config_name}'
                                            ,alpha: true
                                            ,format: 'rgb'
                                            ,color: "{$config.value? $config.value : '#000'}" //默认值
                                            ,done: function(color){
                                                //选色回调
                                                $('#input{$config.config_name}').val(color);
                                            }
                                        });
                                    })

                                </script>




                                {/case}
                                {case value="float"}
                                <!--浮点数-->
                                <div class="layui-form-item">
                                    <div class="layui-col-md7">
                                        <label class="layui-form-label" >{$config.info}</label>
                                        <div class="layui-input-block" id="{$config.config_name}">
                                            <input  type="number" name="{$config.config_name}"
                                                    step="0.001"
                                                    autocomplete="off" placeholder="{$config.info}" class="layui-input"
                                                    value="{$config.value|default=''}">
                                        </div>
                                    </div>
                                    <div class="layui-col-md5">
                                        <div class="layui-input-block" >
                                            {$config.label_name}
                                        </div>
                                    </div>

                                </div>
                                <script>

                                    layui.use(['jquery','layer'],function() {
                                        var $ = layui.jquery,
                                            layer = layui.layer;
                                        $(function(){
                                            var tips;
                                            $('#{$config.config_name}').on({
                                                mouseenter:function(){
                                                    var that = this;
                                                    tips =layer.tips("{$config.desc}",that,{tips:[1,'#5FB878'],time:0,area: 'auto'});
                                                },
                                                mouseleave:function(){
                                                    layer.close(tips);
                                                }
                                            });
                                        })

                                    })

                                </script>
                                {/case}
                                {/switch}

                                {/case}
                                {case value="textarea"}
                                <!--多行文本框-->

                                <div class="layui-form-item">
                                    <div class="layui-col-md7">
                                        <label class="layui-form-label" >{$config.info}</label>
                                        <div class="layui-input-block" id="{$config.config_name}">
                                            <textarea placeholder="{$config.info}" class="layui-textarea"
                                                      style="height:{$config.high? $config.high.'%' : 'auto'};width: {$config.width? $config.width.'%' : '100%'};"

                                                      lay-verify="value" id ='mtext{$config.config_name}'>{$config.value? $config.value : null}</textarea>
                                            <input type="hidden" id="mtext_input_{$config.config_name}" name="{$config.config_name}" value="{$config.value|default=''}"/>
                                        </div>
                                    </div>
                                    <div class="layui-col-md5">
                                        <div class="layui-input-block" >
                                            {$config.label_name}
                                        </div>
                                    </div>

                                </div>
                                <script>

                                    layui.use(['jquery','layer'],function() {
                                        var $ = layui.jquery,
                                            layer = layui.layer;
                                        $(function(){
                                            var tips;
                                            $('#{$config.config_name}').on({
                                                mouseenter:function(){
                                                    var that = this;
                                                    tips =layer.tips("{$config.desc}",that,{tips:[1,'#5FB878'],time:0,area: 'auto'});
                                                },
                                                mouseleave:function(){
                                                    layer.close(tips);
                                                }
                                            });

                                            //输入框的值改变时触发
                                            $("#mtext{$config.config_name}").on("input",function(e){
                                                //获取input输入的值
                                                $('#mtext_input_{$config.config_name}').val(e.delegateTarget.value);
                                            });
                                        })

                                    })

                                </script>

                                {/case}
                                {case value="r_textarea"}
                                <!--富文本框-->


                                <div class="layui-form-item">
                                    <div class="layui-col-md7">
                                        <label class="layui-form-label" >{$config.info}</label>
                                        <div class="layui-input-block" id="{$config.config_name}">
                                          <textarea placeholder="{$config.info}" class="layui-textarea"
                                                    lay-verify="value" id ='rtext{$config.config_name}'>{$config.value? $config.value : null}</textarea>
                                            <input type="hidden" id="rtext_input_{$config.config_name}" name="{$config.config_name}" value="{$config.value|default=''}"/>
                                        </div>
                                    </div>
                                    <div class="layui-col-md5">
                                        <div class="layui-input-block" >
                                            {$config.label_name}
                                        </div>
                                    </div>

                                </div>
                                <script>
                                    var layedit_index{$config.config_name};
                                    layui.use(['jquery','layer','layedit'],function() {
                                        var $ = layui.jquery,
                                            layedit = layui.layedit,
                                            layer = layui.layer;

                                        layedit.set({
                                            uploadImage: {
                                                url: "{:Url('/manage/publicCommon/uploadEditor')}?layui=1" //接口url
                                                ,type: 'post' //默认post
                                            }
                                        });

                                        layedit_index{$config.config_name} = layedit.build('rtext{$config.config_name}',{
                                            height: parseInt("{$config.high? $config.high : 0 }"), //设置编辑器高度
                                            // width: 200
                                        }); //建立编辑器

                                        setInterval(function(){
                                            //console.log(layedit_index);
                                            // console.log('{$config.config_name}');
                                            // console.log(layedit.getContent(layedit_index));
                                            $('#rtext_input_{$config.config_name}').val(r_text_encode(layedit.getContent(layedit_index{$config.config_name})));

                                        },500);

                                        //富文本编辑器改变事件
                                        // $('#LAY_layedit_'+layedit_index).contents().find('body').on('DOMNodeInserted', function () {
                                        //    // layedit.sync(layedit_index);
                                        //     console.log(layedit.getContent(layedit_index));
                                        //
                                        //
                                        // });
                                        $(function(){
                                            var tips;
                                            $('#{$config.config_name}').on({
                                                mouseenter:function(){
                                                    var that = this;
                                                    tips =layer.tips("{$config.desc}",that,{tips:[1,'#5FB878'],time:0,area: 'auto'});
                                                },
                                                mouseleave:function(){
                                                    layer.close(tips);
                                                }
                                            });
                                            //console.log(layedit_index);

                                        })

                                    })


                                </script>


                                {/case}
                                {case value="radio"}
                                <!--单选框-->
                                <div class="layui-form-item">
                                    <div class="layui-col-md7">
                                        <label class="layui-form-label" >{$config.info}</label>
                                        <div class="layui-input-block" id="{$config.config_name}">
                                            {volist name="config.parameter" id="index"}

                                            <input type="radio" name="{$config.config_name}"  value="{$index.value}"  title="{$index.key}" {$config.value==$index.value ?  'checked':'' }  >
                                            {/volist}



                                        </div>
                                    </div>
                                    <div class="layui-col-md5">
                                        <div class="layui-input-block" >
                                            {$config.label_name}
                                        </div>
                                    </div>

                                </div>
                                <script>

                                    layui.use(['jquery','layer'],function() {
                                        var $ = layui.jquery,
                                            layer = layui.layer;
                                        $(function(){
                                            var tips;
                                            $('#{$config.config_name}').on({
                                                mouseenter:function(){
                                                    var that = this;
                                                    tips =layer.tips("{$config.desc}",that,{tips:[1,'#5FB878'],time:0,area: 'auto'});
                                                },
                                                mouseleave:function(){
                                                    layer.close(tips);
                                                }
                                            });
                                        })

                                    })

                                </script>

                                {/case}
                                {case value="checkbox"}
                                <!--复选框-->
                                <div class="layui-form-item">
                                    <div class="layui-col-md7">
                                        <label class="layui-form-label" >{$config.info}</label>
                                        <div class="layui-input-block" id="{$config.config_name}">
                                            {volist name="config.parameter" id="index"}

                                            <input type="checkbox" name="{$config.config_name}[]"  value="{$index.value}"  title="{$index.key}" {if condition="strpos($config.value,$index.value)!==false"}checked="" {/if}   >
                                            {/volist}



                                        </div>
                                    </div>
                                    <div class="layui-col-md5">
                                        <div class="layui-input-block" >
                                            {$config.label_name}
                                        </div>
                                    </div>

                                </div>
                                <script>

                                    layui.use(['jquery','layer'],function() {
                                        var $ = layui.jquery,
                                            layer = layui.layer;
                                        $(function(){
                                            var tips;
                                            $('#{$config.config_name}').on({
                                                mouseenter:function(){
                                                    var that = this;
                                                    tips =layer.tips("{$config.desc}",that,{tips:[1,'#5FB878'],time:0,area: 'auto'});
                                                },
                                                mouseleave:function(){
                                                    layer.close(tips);
                                                }
                                            });
                                        })

                                    })

                                </script>

                                {/case}
                                {case value="select"}
                                <!--下拉框-->
                                <div class="layui-form-item">
                                    <div class="layui-col-md7">
                                        <label class="layui-form-label" >{$config.info}</label>
                                        <div class="layui-input-block" id="{$config.config_name}">
                                            <select name="{$config.config_name}"  lay-verify="required" >
                                                {volist name="config.parameter" id="index"}

                                                <option value="{$index.value}"  {$config.value==$index.value ?  'selected':'' }  >{$index.key}</option>
                                                {/volist}
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-col-md5">
                                        <div class="layui-input-block" >
                                            {$config.label_name}
                                        </div>
                                    </div>

                                </div>
                                <script>

                                    layui.use(['jquery','layer'],function() {
                                        var $ = layui.jquery,
                                            layer = layui.layer;
                                        $(function(){
                                            var tips;
                                            $('#{$config.config_name}').on({
                                                mouseenter:function(){
                                                    var that = this;
                                                    tips =layer.tips("{$config.desc}",that,{tips:[1,'#5FB878'],time:0,area: 'auto'});
                                                },
                                                mouseleave:function(){
                                                    layer.close(tips);
                                                }
                                            });
                                        })

                                    })

                                </script>

                                {/case}
                                {case value="upload"}
                                <!--上传-->

                                {switch name="config.upload_type"}
                                {case value="1"}
                                <!--单图-->
                                <div class="layui-form-item">
                                    <div class="layui-col-md7">
                                        <label class="layui-form-label required">{$config.info}</label>
                                        <div class="layui-input-block layuimini-upload">
                                            <input name="{$config.config_name}" class="layui-input layui-col-xs6" lay-verify="required"  placeholder="{$config.desc}" value="{$config.value? $config.value : ''}">
                                            <div class="layuimini-upload-btn">
                                                <span><a class="layui-btn" data-upload="{$config.config_name}" data-upload-number="one" data-upload-exts="png|jpg|ico|jpeg" data-upload-icon="image"><i class="fa fa-upload"></i> 上传</a></span>
                                                <span><a class="layui-btn layui-btn-normal" id="select_{$config.config_name}" data-upload-select="{$config.config_name}" data-upload-number="one" data-upload-mimetype="image/*"><i class="fa fa-list"></i> 选择</a></span>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="layui-col-md5">
                                        <div class="layui-input-block" >
                                            {$config.label_name}
                                        </div>
                                    </div>

                                </div>
                                <script>
                                    layui.use(['jquery','layer','upload'],function() {
                                        var $ = layui.jquery,
                                            layer = layui.layer,
                                            upload = layui.upload;
                                        $(function(){
                                            var tips;
                                            $('#{$config.config_name}').on({
                                                mouseenter:function(){
                                                    var that = this;
                                                    tips =layer.tips("{$config.desc}",that,{tips:[1,'#5FB878'],time:0,area: 'auto'});
                                                },
                                                mouseleave:function(){
                                                    layer.close(tips);
                                                }
                                            });
                                        })
                                    })


                                </script>

                                {/case}
                                {case value="2"}
                                <!--多图-->

                                <div class="layui-form-item">
                                    <div class="layui-col-md7">
                                        <label class="layui-form-label required">{$config.info}</label>
                                        <div class="layui-input-block layuimini-upload">
                                            <input name="{$config.config_name}" class="layui-input layui-col-xs6" lay-verify="required"  placeholder="{$config.desc}" value="{$config.value? $config.value : ''}">
                                            <div class="layuimini-upload-btn">
                                                <span><a class="layui-btn" data-upload="{$config.config_name}" data-upload-number="more" data-upload-exts="png|jpg|ico|jpeg" data-upload-icon="image" data-upload-sign=""><i class="fa fa-upload"></i> 上传</a></span>
                                                <span><a class="layui-btn layui-btn-normal" id="select_{$config.config_name}" data-upload-select="{$config.config_name}" data-upload-number="more" data-upload-mimetype="image/*" data-upload-sign=""><i class="fa fa-list"></i> 选择</a></span>
                                            </div>

                                            <div></div>
                                        </div>
                                    </div>
                                    <div class="layui-col-md5">
                                        <div class="layui-input-block" >
                                            {$config.label_name}
                                        </div>
                                    </div>
                                </div>


                                <script>
                                    layui.use(['jquery','layer','upload'],function() {
                                        var $ = layui.jquery,
                                            layer = layui.layer,
                                            upload = layui.upload;
                                        $(function(){
                                            var tips;
                                            $('#{$config.config_name}').on({
                                                mouseenter:function(){
                                                    var that = this;
                                                    tips =layer.tips("{$config.desc}",that,{tips:[1,'#5FB878'],time:0,area: 'auto'});
                                                },
                                                mouseleave:function(){
                                                    layer.close(tips);
                                                }
                                            });
                                        })
                                    })

                                </script>




                                {/case}
                                {case value="3"}
                                <!--文件-->
                                <div class="layui-form-item">
                                    <div class="layui-col-md7">
                                        <label class="layui-form-label" >{$config.info}</label>
                                        <div class="layui-input-block" id="{$config.config_name}">
                                            <div class="layui-upload">
                                                <input type="hidden" name="{$config.config_name}" id="inputfileurl{$config.config_name}" value="{$config.value? $config.value : ''}" >

                                                {if condition="$config.value!=''&&$config.value!=null"}

                                                &nbsp&nbsp<span  id="uploadfilevent{$config.config_name}" style="color: #4b646f">{$config.files.name}</span>

                                                {else /}

                                                &nbsp&nbsp<span  id="uploadfilevent{$config.config_name}" style="color: #4b646f">未选择文件</span>

                                                {/if}


                                                <button type="button" class="layui-btn layui-btn-normal" id="uploadfileselect{$config.config_name}">选择文件</button>

                                                <button type="button" class="layui-btn" id="uploadfilesend{$config.config_name}">开始上传</button>
                                                <button class="layui-btn layui-btn-danger" type="button" id="deletefile{$config.config_name}">删除文件</button >
                                            </div>



                                        </div>
                                    </div>
                                    <div class="layui-col-md5">
                                        <div class="layui-input-block" >
                                            {$config.label_name}
                                        </div>
                                    </div>

                                </div>
                                <script>

                                    layui.use(['jquery','layer','upload'],function() {
                                        var $ = layui.jquery,
                                            layer = layui.layer,
                                            upload = layui.upload;
                                        $(function(){
                                            var tips;
                                            $('#{$config.config_name}').on({
                                                mouseenter:function(){
                                                    var that = this;
                                                    tips =layer.tips("{$config.desc}",that,{tips:[1,'#5FB878'],time:0,area: 'auto'});
                                                },
                                                mouseleave:function(){
                                                    layer.close(tips);
                                                }
                                            });
                                        })

                                        var uploadfile{$config.config_name};
                                        //选完文件后不自动上传
                                        upload.render({
                                            elem: '#uploadfileselect{$config.config_name}'
                                            ,url: "{:Url('/manage/publicCommon/upload',['rule'=>'fileExt:jpg,jpeg,png,gif,pem,sql,txt,html,js,css,php'])}" //改成您自己的上传接口
                                            ,auto: false
                                            ,accept:'file'//允许上传的文件类型
                                            //,multiple: true
                                            ,bindAction: '#uploadfilesend{$config.config_name}'
                                            ,choose: function(obj){
                                                // this.files =[];
                                                // //将每次选择的文件追加到文件队列
                                                // var files = this.files = obj.pushFile();
                                                //预读本地文件，如果是多文件，则会遍历。(不支持ie8/9)
                                                obj.preview(function(index, file, result){
                                                    console.log(index); //得到文件索引
                                                    console.log(file); //得到文件对象
                                                    console.log(result); //得到文件base64编码，比如图片
                                                    $('#uploadfilevent{$config.config_name}').html(file.name);

                                                    uploadfile{$config.config_name} = {
                                                        name: file.name,//原文件名
                                                        size: file.size,//大小
                                                        type: file.type,//文件类型
                                                    };
                                                    //obj.resetFile(index, file, '123.jpg'); //重命名文件名，layui 2.3.0 开始新增

                                                    //这里还可以做一些 append 文件列表 DOM 的操作

                                                    //obj.upload(index, file); //对上传失败的单个文件重新上传，一般在某个事件中使用
                                                    //delete files[index]; //删除列表中对应的文件，一般在某个事件中使用
                                                });
                                            }
                                            ,done: function(res, index, upload){
                                                //如果上传失败
                                                if(res.data.errcode > 0){
                                                    return  layer.msg(res.msg, {
                                                        icon: 5,
                                                        time: 1000 //1.5秒关闭（如果不配置，默认是3秒）
                                                    });
                                                }
                                                //上传成功
                                                uploadfile{$config.config_name}.src = res.data.data.src;
                                                $("#inputfileurl{$config.config_name}").val(JSON.stringify(uploadfile{$config.config_name}));
                                                layer.msg(res.msg, {
                                                    icon: 6,
                                                    time: 1000 //1.5秒关闭（如果不配置，默认是3秒）
                                                });
                                                return delete this.files[index]; //删除文件队列已经上传成功的文件
                                            }
                                            ,error: function(){
                                                //演示失败状态，并实现重传
                                                return  layer.msg('上传失败', {
                                                    icon: 5,
                                                    time: 1000 //1.5秒关闭（如果不配置，默认是3秒）
                                                });
                                            }
                                        });
                                        $('#deletefile{$config.config_name}').on('click', function(){
                                            $('#uploadfilevent{$config.config_name}').html('未选择文件');
                                            $("#inputfileurl{$config.config_name}").val('');
                                        });
                                    })

                                </script>

                                {/case}
                                {/switch}


                                {/case}

                                {default /}
                                {/switch}
                                <!--生成表单   end-->
                                <!--<hr class="layui-bg-blue">-->
                                {/volist}
                                    <button type="button" class="layui-btn layui-btn-fluid layui-btn-normal" lay-submit="" lay-filter="formDemo">更新配置</button>
                                </form>
                            </div>
                            {/volist}


                        </div>

                    </div>





                </div>
            </div>
        </div>
    </div>














<!--</form>-->

{/block}

{block name="js"}

<script>

    var table;
    var laydate;
    var	$;
    var form;
    var tab_type='text';
    var bwimage;
    layui.use(['form', 'table','util','laydate','layer','element','bwimage'],function() {
        $ = layui.jquery;
        var util = layui.util,layer = layui.layer ,element = layui.element;
        table = layui.table;
        form = layui.form;
        laydate = layui.laydate;
        bwimage = layui.bwimage;
        form.render();
        bwimage.upload();
        form.on('submit(formDemo)', function (data) {

            // console.log(typeof data.field);
            $.ajax({
                url:"{:Url('setValues')}",
                type:'post',
                data:data.field,
                dataType: "json", contentType: "application/x-www-form-urlencoded; charset=utf-8",
                success:function(data){
                    console.log(typeof data)
                    if(data.data.errcode == 0){
                        layer.msg('处理中...',{shade:[0.8, '#393D49'],time:60*60*2000});
                        layer.msg('修改成功', {
                            icon: 6,
                            time: 1000 //1.5秒关闭（如果不配置，默认是3秒）
                        });
                    }else if(data.errcode != 0){
                        layer.msg(data.msg, {
                            icon: 5,
                            time: 1500 //1.5秒关闭（如果不配置，默认是3秒）
                        });

                    }else{
                        layer.msg('操作失败！请稍后再试。', {
                            icon: 5,
                            time: 1500 //1.5秒关闭（如果不配置，默认是3秒）
                        });

                    }
                },
                error:function(e){
                    layer.alert("提交失败！")
                },

            });
            return false;
        });



        // //触发tab事件
        element.on('tab(docDemoTabBrief)', function(elem){
            // location.hash = 'test='+ $(this).attr('lay-id');
            console.log(elem.index);
            //tab切换下标事件
            tab_type = getType(elem.index);

            // var i  =getIndex("{$entity.type? $entity.type : 'text'}");

            // $(".layui-tab-title li").removeClass("layui-this");
            // $(".layui-tab-content .layui-tab-item").removeClass("layui-show");
            // $(".layui-tab-title li:eq("+elem.index+")").addClass("layui-this");
            // $(".layui-tab-content .layui-tab-item:eq("+elem.index+")").addClass("layui-show");
        });


    })






    function getIndex(type) {
        var rs=0;
        switch(type) {
            case 'text':
                rs=0;
                break;
            case 'textarea':
                rs=1;
                break;
            case 'r_textarea':
                rs=2;
                break;
            case 'radio':
                rs=3;
                break;
            case 'checkbox':
                rs=4;
                break;
            case 'select':
                rs=5;
                break;
            case 'upload':
                rs=6;
                break;
        }
        return rs;
    }

    function getType(index) {
        var rs='text';
        switch(index) {
            case 0:
                rs='text';
                break;
            case 1:
                rs='textarea';
                break;
            case 2:
                rs='r_textarea';
                break;
            case 3:
                rs='radio';
                break;
            case 4:
                rs='checkbox';
                break;
            case 5:
                rs='select';
                break;
            case 6:
                rs='upload';
                break;
        }
        return rs;
    }

    function HTMLDecode(text)
    {
        var temp = document.createElement("div");
        temp.innerHTML = text;
        var output = temp.innerText || temp.textContent;
        temp = null;
        return output;
    }

    /**
     * 富文本编码
     * @param text
     * @returns {string}
     */
    function r_text_encode(text)
    {
        return window.btoa(window.encodeURIComponent(text))
    }

    /**
     * 富文本解码
     * @param text
     * @returns {string}
     */
    function r_text_decode(text)
    {
        return window.decodeURIComponent(window.atob(text))
    }

</script>
{/block}